/*
 * Created by IntelliJ IDEA.
 * User: zslajchrt
 * Date: Feb 23, 2011
 * Time: 9:43:14 PM
 */
package pytest

import chloroform._
import java.util.Locale
import chloroform.l10n.{ResourceBundleProjectMetaDataSource, ProjectLocale}
import scaladuct.l10n.AbstractL10nProperties
import java.lang.{String, Class}
import argo.jdom.JsonRootNode

class ProjectGatewayAFactory {
  def newGateway(): Project = {
    val resolver = new ClasspathResourceResolver()
    val loader = new JsonProjectLoader(resolver) {
      override protected def createJsonProject(projectName: String, projectResource: Resource, projectModel: JsonRootNode) = {
        new JsonProject(projectName, projectResource, projectModel) {
          override def createProjectEntry(packagedArgs: ProjectEntry) = {
            new ProjectEntry(packagedArgs) with InnerProjectEntry with TypedProjectEntry {
              def reloadEntryType() = null

              def getEntryType() = classOf[String] // fake type
            }
          }
        }
      }
    }
    val project: Project = loader.loadProject("testProject")
    new ProjectDecorator(project)
            with ProjectLocale
            with ResourceBundleProjectMetaDataSource
            with AbstractL10nProperties {
      def locale = Locale.ENGLISH

      val bundleName = "testProject"
      val bundlePrefix = ""

      override def extension[T](extClass: Class[T]) = {
        super.extension(extClass)
      }
    }
  }

}